<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
	<script src="<?php echo base_url()?>themes/default/js/jquery.area.js"></script>
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			$(document).ready(function () {
				var province = <?php if (validation_errors()!='')echo set_value('province');else if (isset($city[0]->province_id))echo $city[0]->province_id;?>;
				var city = <?php if (validation_errors()!='')echo set_value('city');else if (isset($city[0]->city_id))echo $city[0]->city_id;?>;
				var area = '';
				_init_area("province","city","area",province,city,area,'<?php echo base_url();?>');
			 });
		</script>

		<ul class="breadcrumb">
			<li>
				<i class="icon-home home-icon"></i>
				<a href="#">系统首页</a>
			</li>
			<li class="active">
				基础数据管理
			</li>
            <li>
				<a href="#">城市管理</a>
			</li>
            <li class="active">
				编辑
			</li>
		</ul><!-- .breadcrumb -->
	</div>
	<div class="page-content">
        
        <div class="page-header">
			<h1>编辑城市管理</h1>
		</div>
		<div class="row">
			 <div class="col-xs-12">
				<!-- PAGE CONTENT BEGINS -->

					<form id="usrform" action="<?php echo base_url()."admin/basis_data/edit_open_city"?>" method="post">
				    	<div class="box-body" style="display: inline-block;width: 100%">
					        <div class="form-group col-xs-12">
					            <label>城市名称</label><span style="color: #a94442;"><?php echo form_error("city_name")?></span>
					            <input name="city_name" type="text" class="form-control" placeholder="输入 ..." value="<?php if (isset($city[0]->city_name))echo $city[0]->city_name;?>" check-type="required">
				            </div>
	                        <div class="form-group col-xs-6">
					            <label>省</label><span style="color: #a94442;"></span>
					                <select id="province" name="province" class="province" style="width: 100%;" check-type="required">
					                    <option value="">省</option>
					                </select>
			                </div>
			                <div class="form-group col-xs-6">
			                    <label>市</label><span style="color: #a94442;"></span>
					                <select id="city" name="city" class="city" style="width: 100%;" check-type="required">
					                    <option value="">市</option>
					                </select>
			                </div>
			                <div class="form-group col-xs-6" style="display: none;" >
				                <select id="area" name="area" class="area" style="width: 100%;">
				                    <option value="">县区</option>
				                </select>
								<input name="id" value="<?php if (isset($city[0]->id))echo $city[0]->id;?>" />
			            	</div>	            
                            <div class="form-group col-xs-12">
                            	<div>
                            		<label>选择开通设备</label><span style="color: #a94442;"></span>
                            	</div>
		                       <?php if (isset($device_category)){
		                                foreach ($device_category as $val){
		                            ?>
		                            <label style="margin-left: 15px;">
                            			<input class="ace" type="checkbox" name="device_category[]" value="<?php echo $val->id ?>" <?php if(!empty($city[0]->device_category)){if(in_array($val->id,$city[0]->device_category)) echo "checked";} ?> />
                            			<span class="lbl"><?php echo $val->name ?></span>
                            		</label>
                            	<?php
									}
								}
	                            ?>
                           </div>
			            </div>
			            <div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<button id="btnSubmit" class="btn btn-info" type="submit">
									<i class="icon-ok bigger-110"></i>
									保存
								</button>
	
								&nbsp; &nbsp; &nbsp;
								<a class="btn" href="<?php echo base_url()."admin/basis_data/open_city"?>">
									<i class="icon-undo bigger-110"></i>
									返回
								</a>
							</div>
						</div>
					</form>
			</div>
		</div><!-- /.row -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
	<script type="text/javascript">
	$("#usrform").validation();
	//保存
	$("#btnSubmit").on('click',function(event){
	  // 2.最后要调用 valid()方法。
	  if ($("#usrform").valid()==false){
	    return false;
	  }
	});
	</script>